std::round, std::lround, std::llround

From Cppreference

Jump to: navigation, search
Defined in header <cmath>

int round( float arg );
(C++0x feature)
int round( double arg );
(C++0x feature)
int round( long double arg );
(C++0x feature)
long lround( float arg );
(C++0x feature)
long lround( double arg );
(C++0x feature)
long lround( long double arg );
(C++0x feature)
long long llround( float arg );
(C++0x feature)
long long llround( double arg );
(C++0x feature)
long long llround( long double arg );
(C++0x feature)

Computes nearest integer to arg. Number is rounded away from zero in halfway cases

Parameters

arg - floating point value

Return value

nearest integer to arg.

See also

floor
nearest integer not greater than the given value
(function)
ceil
nearest integer not less than the given value
(function)
trunc (C++0x)
nearest integer not greater in magnitude than the given value
(function)
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox
In other languages